package com.dean.entity;

import java.util.Map;

/**
 * @ClassName SysMenu
 * @Description 菜单实体类
 * @Author dean
 * @Date 2021/12/26 13:02
 */
public class SysMenu {
    private final String MENU_NAME="MENU_NAME";
    private final String MENU_CLASS="MENU_CLASS";
    private final String MENU_STATUS="MENU_STATUS";
    private final String ORDER_NO="ORDER_NO";
    /**
     * 菜单名称
     */
    private String menuName;
    /**
     * 菜单访问class
     */
    private String menuClass;
    /**
     * 菜单状态
     */
    private String menuStatus;
    /**
     * 菜单排序
     */
    private Integer orderNo;

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public String getMenuClass() {
        return menuClass;
    }

    public void setMenuClass(String menuClass) {
        this.menuClass = menuClass;
    }

    public String getMenuStatus() {
        return menuStatus;
    }

    public void setMenuStatus(String menuStatus) {
        this.menuStatus = menuStatus;
    }

    public Integer getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(Integer orderNo) {
        this.orderNo = orderNo;
    }

    /**
     * 设置指定的字段信息
     * @param fieldName
     * @param fieldValue
     */
    public void set(String fieldName,Object fieldValue) {
        fieldName = fieldName.toUpperCase();
        String value = fieldValue == null ? null : String.valueOf(fieldValue);
        switch (fieldName) {
            case MENU_NAME:
                setMenuName(value);
                break;
            case MENU_CLASS:
                setMenuClass(value);
                break;
            case MENU_STATUS:
                setMenuStatus(value);
                break;
            case ORDER_NO:
                setOrderNo(value == null ? null : Integer.parseInt(value));
                break;
            default:
                break;
        }
    }

    /**
     * 将map转为实体类
     * @param map
     */
    public void set(Map<String,Object> map){
        map.forEach((key,val)->{
            set(key,val);
        });
    }

    @Override
    public String toString() {
        return "SysMenu{" +
                "menuName='" + menuName + '\'' +
                ", menuClass='" + menuClass + '\'' +
                ", menuStatus='" + menuStatus + '\'' +
                ", orderNo=" + orderNo +
                '}';
    }




}
